﻿using System;
using System.Collections.Generic;
using Protocol.Constant;

namespace Protocol.Dto.Fight
{
    /// <summary>
    ///玩家的传输模型
    /// </summary>
    [Serializable]
    public class PlayerDto
    {
        public int userId;

        public int identity;

        public List<CardDto> cardList;

        public PlayerDto(int userId)
        {
            identity = Identity.FARMER;
            this.userId = userId;
            cardList = new List<CardDto>();
        }

        /// <summary>
        /// 是否有手牌的方法
        /// </summary>
        /// <returns>true 有手牌</returns>
        public bool HaveCard()
        {
            return cardList.Count != 0;
        }


        /// <summary>
        /// 返回卡片数量
        /// </summary>
        /// <returns></returns>
        public int CardCount()
        {
            return cardList.Count;
        }

        /// <summary>
        /// 添加卡牌
        /// </summary>
        /// <param name="cardDto"></param>
        public void AddCard(CardDto cardDto)
        {
            cardList.Add(cardDto);
        }

        /// <summary>
        /// 移除卡牌
        /// </summary>
        /// <param name="cardDto"></param>
        public void Remove(CardDto cardDto)
        {
            cardList.Remove(cardDto);
        }
    }
}